home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HPAVC
/
HPAVC CD-ROM.iso
/
PACKER.ZIP
/
PACKER.DOC
< prev
next >
Wrap
Text File
|
1994-10-08
|
17KB
|
337 lines
┌─────────────────────────────────────────────────────────────────────────┐
│ ▀██▀█▄ ██ ▄█▀▀▄ ▀██ ▄▄ ▀██▀▀██ ▀██▀█▄ ▄▄ ▄▄▄ │█
│ ██▄█▀ ▐██▌ ▐█▌ ██ ▄█▀ ██ ▄ ▀ ██▄█▀ ▄▀██ ██ ██ │█
│ ██ █▄██ ██ ████▄ ██▀█ ██▀█▄ ██ ██ ██ │█
│ ██ ▐▌ ▐█▌ ▐█▌ ██▀██▄ ██ ▄ ██ ▐█▌ ██ ██ ██ │█
│ ▄██ ▄█▄ ▄██▄ ▀█▄▄▀ ▄██ ██▄ ▄██▄▄██ ▄██ ██▄ ▄██▄ ██ ▀█▄█▀ │█
└─────────────────────────────────────────────────────────────────────────┘█
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Packer (for TP) version 1.0 (c) 1994 IH software engineering, ISRAEL.
┌──────────────────────────────────────────────────────────────────────────┐
│░░░▒▒▒▓▓▓ Introduction ▓▓▓▒▒▒░░░│
└──────────────────────────────────────────────────────────────────────────┘
Packer is a tool for Turbo Pascal programmers, that will make your software
more PROFESSIONAL than ever!
Packer will combine all your programs files into 1 large file, and give
you the appropriate tools to access this package within your programs!
To DEMONSTRATE the functional usage of Packer, take for instance a simple
GAME - the game uses pictures, fonts, etc., a total of some 50 files.
That is not very elegant, is it? That's where packer gets into the picture:
Packer will take all those files that your program uses, and convert them
into 1 big file (package), so your program is now made of ONLY 2 FILES:
EXE and PAK! An extremly powerful option is to convert those 2 files into
ONLY 1 file by copying the package to the EXE file! Doesn't it look
PROFESSIONAL ?!?
You are probably thinking now : "I can make my personal Packer" - Well,
you can, but it will take you a lot of time, and time is money, so why
won't you give this great tool a chance? You can use Packer right now
for evaluation and testing. If you like it (and you WILL like it!), you
will probably register it! Packer was built to SAVE YOU TIME in your
programming work, so don't waste your time for nothing, purcase Packer now!
┌──────────────────────────────────────────────────────────────────────────┐
│░░░▒▒▒▓▓▓ Registration ▓▓▓▒▒▒░░░│
└──────────────────────────────────────────────────────────────────────────┘
Packer IS NOT FREE, it is neither shareware nor public domain. It consists
of many hours of hard work, and deserves payment. Therefore, only the TPU
file (Compiled unit) is distributed to you, so you can test this program
and decide if you want to use it or not. If you want to use Packer, you
will have to register it by printing the registration form (included in
this archive) and sending it to me (the author) to the address listed in
the registration form. To print the registration form, just type at the
DOS-prompt : COPY WORLD.REG PRN
If you have a Modem connected to your computer, you may choose not to get
Packer on a disk, but get it with your modem. This will save you the
Disk & P&P fee. If you choose so, you will have to call Fata-Morgana BBS,
+972-6-526125 (06-526125 inside Israel) and download the registered version
of Packer - registered to you. In this case, please call about 1 or 2 weeks
after you send the registration form by mail. Only a week after you send
this form you should try to call the BBS. You will have instructions
on-line how to download your Packer. Please make sure your communication
program is set to 8,N,1 and ANSI emulation. At logon, enter: Packer User
The BBS password is: Packer. Then enter your personal password (as you
choosed in the form) and your phone number. After this validation, the
registered version of Packer with be sent to you with Z-modem protocol.
This procedure will take maximum 5 minutes to stay on-line.
After registration you will receive the registered version of Packer,
registered to you, (or your company), without any annoying "unregistered"
message and with EXTRA BONUS read / write routines that will make your
programming much easier, and you will also get 50% discount on future
releases of Packer (c) from IH software!
BBS OPERATORS (SYSOPS) - Contact us if you want your BBS to support the
Packer, and you will receive free updates whenever available. Print the
SYSOP.DOC file for more details.
VENDORS and SOFTWARE PUBLISHERS - You may put this program into your CD-
collections if you like, but please notify us if you do that. Please
print the VENDOR.DOC file and send it to us.
┌──────────────────────────────────────────────────────────────────────────┐
│░░░▒▒▒▓▓▓ Lisence and agreement ▓▓▓▒▒▒░░░│
└──────────────────────────────────────────────────────────────────────────┘
There is no warranty with this software. IH software takes no responsibility
for any damage caused by usage of this software.
You may upload this archive to any BBS if you like, but with no changes!
To get the original Packer archive, call Fata-Morgana BBS: telephone #:
+972-6-526125, 24 hours a day, max speed: 14,400 bps.
You MAY NOT copy or distribute the registered version of Packer
(PACKER.TPU), nor charge for unauthorized usage of Packer.
Every program you create with Packer will have your serial number in it,
so IH software will be able to locate unlawful users and prosecute them
acording to international copyright laws.
IH software will be glad to solve your problems / questions ONLY after
registration and showing your support. Your registration is required in
order to make this software succeed.
┌──────────────────────────────────────────────────────────────────────────┐
│░░░▒▒▒▓▓▓ Installation ▓▓▓▒▒▒░░░│
└──────────────────────────────────────────────────────────────────────────┘
Copy the appropriate version of PACKER.TPU into your units-directory:
PACKER60.TPU - Packer for Turbo Pascal 6
PACKER70.TPU - Packer for Turbo Pascal 7
PACKER70.TPP - Packer for Borland Pascal 7 (Protected mode)
PACKER70.TPW - Packer for Borland Pascal 7 (Windows version)
Very important! You MUST rename the file to PACKER.TPU/TPP/TPW !
═══════════════
Rename it to PACKER.TPU if you use Turbo Pascal, or to PACKER.BPU if you
use Borland Pascal.
To use Packer in one of your programs, implement Packer at the beginning
of the program (in the USES part). Examples: Uses Packer;
┌──────────────────────────────────────────────────────────────────────────┐
│░░░▒▒▒▓▓▓ Creating Packs with PACKER.EXE ▓▓▓▒▒▒░░░│
└──────────────────────────────────────────────────────────────────────────┘
With the file PACKER.EXE (included in this package) you will build your
packs for your programs. This is an external program that will combine
all the files that your program needs into 1 large Pack file.
Enter at the DOS-prompt: PACKER and you will be asked for a name for your
pack. You can supply this name in the command line parameter, by typing
PACKER <packname>. Then press "Y" to create a new packet.
You will now have to set the maximum number of files in your pack file.
The range must be from 1 to 3120. The less this number, the less disk
space your pack will take.
Note that you will not be able to pack MORE files than this maximum number,
but you can easily pack LESS files, leaving you extra space for more files.
After you size your pack, you will reach the main menu of PACKER.EXE.
You have the option to Add files to the Pack, List files in the pack,
or Delete the entire Pack. Deleting a specific file from the Pack is
available only in the REGISTERED version of Packer.
After you finish adding files into your pack, press Q to quit from
PACKER.EXE. Your Pack is now ready!
Note that you can run PACKER.EXE on your pack to edit / view / add more
files to your pack at any time you want.
┌──────────────────────────────────────────────────────────────────────────┐
│░░░▒▒▒▓▓▓ Functions and Procedures ▓▓▓▒▒▒░░░│
└──────────────────────────────────────────────────────────────────────────┘
PROCEDURE InitPack (FileName:String);
PROCEDURE InitFileInPack (FileNumber:Word);
PROCEDURE SeekFileInPack (SeekPos:LongInt);
PROCEDURE PackReadBlock (var buf; count:Word; var result:word);
PROCEDURE PackReadByte (var B:Byte);
PROCEDURE ClosePack;
FUNCTION GetFileNumber (FileName : String) : Word;
FUNCTION GetFileName (FileNumber : Word) : String;
FUNCTION GetFileSize (FileNumber : Word) : LongInt;
FUNCTION GetFilePosition : LongInt;
FUNCTION GetNumberOfFiles : Word;
PROCEDURE InitPack (FileName:String);
This procedure should be called before the other functions & procedures.
It will init the Pack for reading, and take care of some other things
as well... FileName is a full path name of a Pack file, or EXE file which
stores the Pack as an overlay. In both ways, the procedure will take care
of identifing the pack, and you don't have to worry about it!
The procedure will allocate some memory for the files-list inside your
Pack, and will need 21 bytes for each file in your Pack. Don't forget to
deallocate that memory after you finish using the Pack (look: ClosePack).
Example: InitPack ('TEST.PAK');
PRROCEDURE InitFileInPack (FileNumber:Word);
This procedure will initialize Packer for reading a specific file from
the Pack. You must call the InitPack procedure before you can use this
procedure. FileNumber should be the number of the file you want to init.
Example: InitFileInPack (1);
PROCEDURE SeekFileInPack (SeekPos:LongInt);
Like the regular SEEK procedure, this one will move the file pointer to
a specific location in the file. SeekPos is the location you want to seek
into. 0 is the first byte of the file, and the last byte of the file is
located in FileSize-1. Use InitFileInPack before calling this procedure.
Example: SeekFileInPack(99);
PROCEDURE PackReadBlock (var buf; count:word; var result:word);
This is a powerful and fast reading procedure!
You can read from the Pack (after you call InitFileInPack) to any variable
you want! This can be an array, pointer, word, longint, string, etc...
buf is an untyped variable, and will contain the data that will be read
from the file. Count is the number of bytes to read from the file into
the memory. You can read up to 64KB at the same time because of the 64K
limitation. result will contain the number of bytes that were read from
the file. If result < count, then you tried to read past the end of the
file. In result = count, everything was fine. Note that you must use the
result variable, and it is not optional.
Example: PackReadBlock (P^,65535,result); { var P:Pointer }
Note that when using pointers, you must take care of the GetMem and
FreeMem procedures. Don't forget the to add the "^" after the name of the
pointer. This is VERY important!
Another example: PackReadBlock (S40,41,result); { var S40:String[40] }
In this example, Packer will read 41 bytes into the String variable.
Note that you should read 1 extra byte, which contains the actual length
of the string. To read a word variable, you need to read 2 bytes, so you
write: PackReadBlock (W,2,result); { var W:Word }
After you use this procedure, the seek-pointer will point to the next
byte in the file that wasn't read yet.
PROCEDURE PackReadByte (var B:Byte);
This is a very easy procedure that will read 1 byte from the current
position of the file into a Byte variable.
Example: PackReadByte (B);
This procedure is similar to PackReadBlock (B,1,result);
PROCEDURE ClosePack;
After you finish using your Pack, or before you want to Init a different
Pack, you should call this procedure to deallocate the memory that was
used to store the files names. Use this procedure before you exit your
program! Example: ClosePack;
FUNCTION GetFileNumber (FileName : String) : Word;
This function will get the string variable "FileName", look if it exists
in your Pack file, and if so - it will return the FileNumber.
Example: InitFileInPack( GetFileNumber('TEST.DAT') );
The InitPack procedure gets a word-type parameter, but you can use the
GetFileNumber function to use file names instead of file numbers.
The first file in the Pack is number 1, and so on.
If you want to init a file, and you don't know it's number, you can use
the GetFileNumber function. But if you know the number of the file, it is
better to use the number instead of the filename, since it takes less
space, less memory and that means - better performances!
Note that you must call InitPack before using this function!
FUNCTION GetFileName (FileNumber : Word) : String;
This is the oposite of GetFileNumber. This function will take a word-type
parameter, and return the file name as a string-type.
Example: WriteLn ( GetFileName(1) );
FUNCTION GetFileSize (FileNumber : Word) : LongInt;
This function will return the size of file inside the Pack. FileNumber is
the number of the file in the Pack. The function will return a LongInt-
type variable, with the size of the file in bytes.
FUNCTION GetFilePosition : LongInt;
The function will return the current seek position in the current file.
After you call InitFileInPack, the seek position is reset to 0.
Every time you read from the file with PackReadBlock / PackReadByte,
the seek pointer is increased to the next location in the file.
FUNCTION GetNumberOfFiles : Word;
This function will return the number of files in the Pack. It should be
called after InitPack.
Example: WriteLn('Number of files in your Pack: ',GetNumberOfFiles);
PACKER ERRORS:
1. Overlay not found in EXE file
2. Error in Pack file
3. Pack file not found
┌──────────────────────────────────────────────────────────────────────────┐
│░░░▒▒▒▓▓▓ Linking the Pack with the EXE file ▓▓▓▒▒▒░░░│
└──────────────────────────────────────────────────────────────────────────┘
You have probably wondered how it can be done, right?
First, you have to create your Pack with PACKER.EXE, and save it by the
name MYPACK.PAK (or any other name). Then, in your program source code,
use the TEMPORARY command InitPack('C:\PATH\MYPACK.PAK');
This will allow you to debug your program, test it, etc.
ONLY after your program is 100% ready, and you have tested it few times,
you should follow these instructions:
1. Change the temporary command to InitPack(ParamStr(0));
2. Compile your program (do not run it yet!) and create the EXE file.
3. In the DOS-prompt type: COPY /B PROGRAM.EXE + MYPACK.PAK PROGRAM.EXE.
Now your program is made from only 1 file! Remember that you can not run
the program from Turbo Pascal itself. You must compile the program first!
About EXE files compressors (like PKLITE and LZEXE):
Packer will still work, but remember to compress the EXE file BEFORE you
link the Pack to the EXE file.
ParamStr(0) is the full path & name of the program that is being loaded,
for instance: 'C:\PATH\PROGRAM.EXE';
Packer will automatically determine if the EXE file contains the PAK
as an overlay or not.
┌──────────────────────────────────────────────────────────────────────────┐
│░░░▒▒▒▓▓▓ Thanks to: ▓▓▓▒▒▒░░░│
└──────────────────────────────────────────────────────────────────────────┘
Thanks go to all the following people and all the other guys I forgot
to mention their names!
Aric Fedida - Who tought me Turbo Pascal - Thanks man!
Tzvika Gelber - Who gave me the inspiration for writing this software!
Goor Sasson - Thanks for helping me solve the pointer bug!
Ohad Shalom - Hi dude... Thanks for helping me every time you call :)